
{include file="common/_header"}
<body class="login-bg">


<div class="login layui-anim layui-anim-up">
    <div class="message">美丽云后台管理登录</div>
    <div id="darkbannerwrap"></div>


    <form method="post" class="layui-form" >
        <input name="type" type="hidden" value="1">
        <input name="user_name" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
        <hr class="hr15">
        <input name="userpass" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" id="login" lay-submit lay-filter="login" style="width:100%;" type="button">
<!--        <div style="font-size: 16px;margin: 30px 0 0 0px;"><a href="/admin/forgot" >忘记密码</a></div>-->
<!--        <hr class="hr20" >-->
    </form>
</div>
<script>

    function keyCodeShow(e)
    {
        var evt = e || window.event;
        console.log(evt.keyCode);
        if(evt.keyCode == 13){
            $('#login').click();
            return false;
        }
    }
    document.onkeydown=keyCodeShow;

    layui.use('form', function() {
        var form = layui.form;



        form.on('submit(login)', function (data) {
            $.ajax({
                url: '/admin/login',
                data: data.field, // 表单序列化
                dataType: 'json',
                type: 'post',
                success: function (data) {
                    console.log(data);
                    if (data.code == 1) {
                        layer.msg(data.msg, {
                            icon: 6,
                            time: 1500,
                        }, function () {
                            window.location.href = data.url;
                        });
                    } else {
                        layer.open({
                            title: '登录失败',
                            content: data.msg,
                            icon: 5,
                            anim: 6,
                        });
                    }
                }
            });
        });
    });
</script>
</body>

{include file="common/_bottom"}